package com.lagou.work.workthree;

/*
 * 通话套餐类
 * */
public class PhonePac extends PricingPac implements PhoneSer {
    //通话时长(分钟)
    private int duration;
    //短信条数
    private int creedNumber;
//    //每月资费
//    private double monthCharge;

    public PhonePac() {
        super();
    }

    public PhonePac(int duration, int creedNumber, double monthCharge) {
        super(monthCharge);
        setDuration(duration);
        setCreedNumber(creedNumber);
//        setMonthCharge(monthCharge);
    }

    public int getDuration() {
        return duration;
    }

    public void setDuration(int duration) {
        this.duration = duration;
    }

    public int getCreedNumber() {
        return creedNumber;
    }

    public void setCreedNumber(int creedNumber) {
        this.creedNumber = creedNumber;
    }

//    public double getMonthCharge() {
//        return monthCharge;
//    }
//
//    public void setMonthCharge(double monthCharge) {
//        this.monthCharge = monthCharge;
//    }

//    public void show(PhonePac[] phonePacs){
//        //打印所有套餐信息
//        for (int i = 0; i < phonePacs.length; i++) {
//            System.out.println("通话时长:" + phonePacs[i].getDuration() + ",短信条数:" + phonePacs[i].getCreedNumber() + ",每月资费:" + phonePacs[i].getMonthCharge());
//        }
//    }

    @Override
    public void show() {
        System.out.println("通话时长:" + getDuration() + ",短信条数:" + getCreedNumber() + ",每月资费:" + getMonthCharge());
    }

    @Override
    public void callPhone(int duration, PhoneCard phoneCard) {
        //调用电话卡的show方法，展示对应的信息
        phoneCard.show();
        //展示对应电话套餐的信息
        show();
        System.out.println(phoneCard.getUserName() + "打了" + duration + "分钟电话");
        int remainNum = getDuration() - duration;
        System.out.println("还剩余" + remainNum + "分钟");

    }
}
